%li.highlight[pending]
  - unless pending.category.blank?
    .strip{class: pending.category}= t(pending.category)
  - else
    .strip.white #{t :other}

  .tools
    = link_to_task_edit(pending, bucket) + " | "
    = link_to_discard(pending) + " | " if shown_on_landing_page?
    = link_to_task_delete(pending, bucket)

  = check_box_tag dom_id(pending, :complete), 1, false, onclick: link_to_task_complete(pending, bucket)

  .indentwide
    %label{ id: dom_id(pending, :name) }
      - if pending.user.id != current_user.id
        = t(:task_from, link_to(h(pending.user.full_name), user_path(pending.user))).html_safe + ':'
      = auto_link h(pending.name)
      - if pending.asset_id?
        =t :related
        = link_to(h(pending.asset.name), polymorphic_url(pending.asset))
      &ndash;
    %tt
      - if pending.bucket == "due_asap"
        %span.urgent= t(:task_due_now)

      - elsif pending.bucket == "due_later"
        = t(:task_due_later)

      - else
        - if pending.at_specific_time?
          - if pending.due_at < Time.now
            %span.warn= distance_of_time_in_words(pending.due_at, Time.now)
            = t(:task_overdue)
            = l(pending.due_at.localtime, format: :mmddhhss)
          - else
            = t(:task_due_in, distance_of_time_in_words(Time.now, pending.due_at.localtime))
            = "(#{l(pending.due_at.localtime, format: :mmddhhss)})"

        - else
          - if pending.due_at < Date.today
            %span.warn= distance_of_time_in_words(pending.due_at, Time.now)
            = t(:task_overdue)
            = l(pending.due_at.localtime.to_date, format: :mmdd)
          - elsif pending.due_at > Date.today
            = t(:task_due_in, distance_of_time_in_words(Time.now, pending.due_at.localtime.end_of_day))
          - else
            %span.cool= t(:task_due_today)

    - unless pending.background_info.blank?
      %div
        %dt= h(pending.background_info)
